<html>
	<head>
		<link href="/style.css" rel="stylesheet" type="text/css">
	</head>
	<body>
		<div id="container">
			<div id='text' class='content'></div>
		</div>
    <script src="/channel/bcsocket.js"></script>
		<script src="/share/share.uncompressed.js" type="text/javascript"></script>
		<script type="text/javascript">

	var elem = document.getElementById('text');

	sharejs.open('html', 'text', function(error, doc) {
		if (error) {
			console.error(error);
		} else {
			document.title = doc.name;

			var update = function() {
				elem.innerHTML = doc.snapshot;
			}

			update();
			window.doc = doc;
			doc.on('change', update);


			if (doc.created) {
				doc.submitOp([{i:"<h1>Hello there.</h1>\n<p>a simple p</p>", p:0}]);
			}
		}
	});
		</script>
	</body>
</html>
